<template>
	<view class="app">
		<view class="">
			<view class="" v-for="(item, index) in motionList" :key="index" @tap='seeDec(item)'>
				<view class="">
					<text>{{item.title}}</text>
					<text>{{item.createDate|dateFilters}}</text>
					<text>科局：{{item.departmentName ||'暂无'}}</text>
				</view>
				<view class="">
					<text v-if="item.appraise==1">满意</text>
					<text v-else-if="item.appraise==2">基本满意</text>
					<text v-else-if="item.appraise==3">不满意</text>
					<text v-else>未评价</text>
				</view>
			</view>
		</view>
		<view class="">
			<view class="loading-text">{{ loadingText }}</view>
		</view>
		<view class="app-fiexd" v-if='type==1'>
			<navigator hover-class="none" url="../../motion/motion"><image src="https://gnzxwylz.xlygrcw.com/upload/GNZX/home/9.png" mode="widthFix"></image></navigator>
		</view>
	</view>
</template>

<script>
import validate from '../../../utils/validate.js';
export default {
	data() {
		return {
			page: 1,
			pageSize: 10,
			loadingText: '到底了......',
			motionList:[],
			type:null
		};
	},
	components: {},
	onShow() {
		const loginState = validate.isEmptyVal(uni.getStorageSync('gnzx_users'));
		if (loginState) {
			uni.navigateTo({
				url: '../../login/login'
			});
		}
		
		this.user = uni.getStorageSync('gnzx_users')
		this.type = this.user.frontType
	},
	onShow() {
		this.motionList=[]
		this.page =1
		this.getMintionList()
	},
	onReachBottom: function() {
		this.page++;
		console.log(this.page);
		this.getMintionList()
	},
	methods: {
		getMintionList(){
			var _this = this
			const param = {
				currentPage:this.page,
				pageSize:this.pageSize,
				title:'',
				applyId:''
			}
			this.request({
				url: this.interfaces.getMintionList,
				data:param,
				method: 'POST',
				success: res => {
					console.log(res.list)
					if(res.list.length>0){
						this.motionList = [...this.motionList,...res.list]
						this.loadingText = '加载中......'
					}
					else{
						this.loadingText = '到底了......'
					}
					
					console.log(res.list);
					console.log(this.motionList)
				},
				fail(e) {
					uni.showToast({
						title: '获取失败'
					});
				}
			});
		},
		
		seeDec(data){
			uni.navigateTo({
				url:'../../motion/motionDec1?id=' + data.id
			})
		}
	}
};
</script>

<style lang="scss">
.app {
	padding: 0 50upx;
	border-top: 1px solid #eee;
	> view {
		&:nth-child(1) {
			> view {
				padding: 40upx 0;
				border-bottom: 1px solid #eee;
				display: flex;
				align-items: center;
				view {
					&:nth-child(1) {
						flex: 1;
						text {
							display: block;
							&:nth-child(1) {
								font-size: 32upx;
								font-family: PingFang SC;
								font-weight: bold;
								color: #333333;
								line-height: 60upx;
							}
							&:nth-child(2) {
								padding: 10upx 0;
								font-size: 24upx;
								font-family: PingFang SC;
								font-weight: 400;
								color: #999999;
							}
							&:nth-child(3) {
								font-size: 24upx;
								font-family: PingFang SC;
								font-weight: 400;
								color: #c8000b;
							}
						}
					}
					&:nth-child(2) {
						margin-left: 20upx;
						width: 133upx;
						height: 46upx;
						background: #ffffff;
						border: 1px solid #ec020e;
						border-radius: 5upx;
						text-align: center;
						line-height: 46upx;
						font-size: 26upx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #ec020e;
					}
				}
			}
		}
	}
	.app-fiexd {
		position: fixed;
		top: 500upx;
		right: 50upx;
		image {
			width: 160upx;
		}
	}
}
</style>
